let $request = (url, data, method = 'GET', header = {}) => {
	return new Promise((resolve, reject) => {
		uni.showLoading({
			title: '加载中...',
			mask: true
		})
		uni.request({
			// url: 'http://localhost/' + url,
			url,
			method,
			data,
			success({
				data
			}) {
				resolve(data)
			},
			fail(e) {
				reject(e)
			},
			complete() {
				uni.hideLoading()
			}
		})
	})
}

let $get = (url, data, header = {}) => {
	return $request(url, data, 'GET', header)
}

let $post = (url, data, header = {}) => {
	return $request(url, data, 'POST', header)
}

uni.$request = $request
uni.$get = $get
uni.$post = $post
